from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
import time
from jdb import A3mall
dr=webdriver.Edge()
dr.get('http://10.59.9.14:7003/home/login.html')
dr.find_element(By.NAME,'username').send_keys('15649920329')
time.sleep(2)
dr.find_element(By.NAME,'password').send_keys('1234567')
time.sleep(10)
dr.find_element(By.XPATH,'/html/body/div[4]/div/div[1]/div[2]/form/div[5]/a').click()
time.sleep(5)
b=A3mall(host='10.59.9.14',password='yidong666',user='root',data='a3mall')
c=dr.find_element(By.XPATH,'/html/body/div[5]/div[2]/div[1]/div[2]/div[2]/ul/li[2]/span[1]').text
a=int(c.replace(' 积分',''))
d=b.cx('select point from mall_users where username="15649920329"')

assert a==d[0][0]
time.sleep(10)
com=dr.get_cookies()
time.sleep(2)
dr.quit()
dr=webdriver.Edge()
dr.get('http://10.59.9.14:7003/home/login.html')
time.sleep(2)
for i in com:
    dr.add_cookie(i)
time.sleep(2)
dr.refresh()
time.sleep(5)